package jp.cane.delicious.recipe05;

import jp.cane.delicious.recipe04.R;
import android.content.Context;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class Button1ClickListener implements OnClickListener {
	private Context context;

	private Handler handler;

	Button1ClickListener(Context context) {
		this.context = context;
		this.handler = new Handler();
	}

	public void onClick(View v) {
		new Thread() {
			public void run() {
				try {
					Thread.sleep(3000);
					Runnable r = new Thread() {
						public void run() {
							Toast.makeText(Button1ClickListener.this.context,
									R.string.toast, Toast.LENGTH_SHORT).show();
						}
					};
					Button1ClickListener.this.handler.post(r);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}.start();
	}
}
